package offer;

public class Offer5 {
    class Solution {
        public String replaceSpace(String s) {
            StringBuilder sb = new StringBuilder();
            //StringBuffer sb = new StringBuffer();
            int length = s.length();
            for (int i = 0; i < length; i++) {
                char c = s.charAt(i);
                if (c == ' ') {
                    sb.append("%20");
                } else {
                    sb.append(c);
                }
            }
            return sb.toString();
        }
    }
}
